home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3974 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: prodigy.com!usenet
  2. From: FSMJ76A@prodigy.com (Stephen Pride)
  3. Newsgroups: comp.lang.c
  4. Subject: Command Line Wildcards (* and ?)
  5. Date: 1 Feb 1996 06:52:54 GMT
  6. Organization: Prodigy Services Company  1-800-PRODIGY
  7. Distribution: world
  8. Message-ID: <4epo06$170s@useneta1.news.prodigy.com>
  9. NNTP-Posting-Host: inugap5.news.prodigy.com
  10. X-Newsreader: Version 1.2
  11.  
  12. Does anyone know how I could create a program that can accept wildcards
  13. (* and ?) for arguments and have the arguments linked into records of a
  14. database?  For example (and this is a *crude* example):
  15.  
  16. Suppose I have an ascii file.  Each record in the ascii file is a nothing 
  17. more than a char array (a person's name) that is terminated by a null and 
  18. then a
  19. newline character, like this:
  20.  
  21. John Doe
  22. Sarah Doe
  23. John Q. Public
  24.  
  25. I want to create a program that can accept a variable number of arguments 
  26. on the command line and also have any of the arguments contain wildcards. 
  27.  That is, if the program's name is DBPGM and I want to just find the 
  28. records
  29. that start with "J" I would enter:  DBPGM J*, and it would find only 
  30. "John Doe"
  31. and "John Q Public" or: DBPGM *DOE and it would find "John Doe" and 
  32. "Sarah Doe".   I'm not looking for someone to write such a program, but 
  33. instead I need help in converting the wildcard arguments into regular-
  34. expression strings.  Sorry, I should have mentioned I am using Turbo C++
  35. and not Unix/C (which has such functions: regex/regcmp).
  36.  
  37. Thanks!
  38. Steve
  39.  
  40.  
  41.